<?php

namespace app\apisell\controller\admin;

use app\apisell\service\GoodsTuan\GoodsTuanService;
use app\common\controller\QywxController;
use app\common\utils\Curl;
use app\common\utils\Res;
use think\facade\Db;

class GoodsTuan extends QywxController
{
    /**
     *1商品列表
     */
    public function getList()
    {
        $param = $this->request->param();
        $result = GoodsTuanService::getList($param);

        return $result;
    }

    /**
     * 2创建商品
     */
    public function addGoods()
    {
        $param = $this->request->param();
        $uid = $this->request->uid;
        $result = GoodsTuanService::addGoods($param,$uid);
        $data = [
            'list' => $result,
            'total' => 0
        ];
        return Res::ok($data);
    }
    /**
     * 3调价提交
     */
    public function changePrice()
    {
        $param = $this->request->param();

        $uid = $this->request->uid;

        $result = GoodsTuanService::changePrice($param,$uid);

        $data = [
            'list' => $result,
            'total' => 0
        ];
        return Res::ok($data);
    }
    /**
     * 4获取推广链接数
     */
    public function getPopulinks()
    {
        $param = $this->request->param();

        $data = GoodsTuanService::getPopulinks($param);

        return Res::ok($data);
    }
    /**
     * 5商品详情
     */
    public function goodsDetail()
    {
        $param = $this->request->param();

        $result = GoodsTuanService::goodsDetail($param);

        return $result;
    }
    /**
     * 6商品编辑
     */
    public function goodsEdit()
    {
        $param = $this->request->param();

        $result = GoodsTuanService::goodsEdit($param);

        return $result;
    }
    /**
     * 7商品禁用
     */
    public function goodsDisable()
    {
        $param = $this->request->param();

        $uid = $this->request->uid;

        $result = GoodsTuanService::goodsDisable($param,$uid);

        return $result;
    }
     /**
     * 8商品删除
     */
    public function goodsDelete()
    {
        $param = $this->request->param();

        $uid = $this->request->uid;

        $result = GoodsTuanService::goodsDelete($param,$uid);

        return $result;
    }
    /**
     * 8商品调价记录
     */
    public function changePriceLog()
    {
        $param = $this->request->param();

        $goods_id = $param['id'];//商品id

        $result = GoodsTuanService::changePriceLog($param);
        $data = [
            'list' => $result,
            'total' => 0
        ];
        return Res::ok($data);
    }

    /**
     * 9商品调价定时任务
     */
    public function change_price_task()
    {
        $param = $this->request->param();

        $result = GoodsTuanService::change_price_task();
        $data = [
            'list' => $result,
            'total' => 0
        ];
        return Res::ok($data);
    }






































    
}